//
//  myScrollView.m
//  scrollTouch
//
//  Created by wangjun on 11-6-1.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "myScrollView.h"

#import "MyView.h"

@implementation myScrollView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor redColor]];
        
        MyView *myView=[[MyView alloc] initWithFrame:CGRectMake(1, 3, 100, 200)];
        [self addSubview:myView];
        [myView release];
    }
    return self;
}


- (void)dealloc
{
    [super dealloc];
}

- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
{
    NSLog(@"用户点击了scroll上的视图%@,是否开始滚动scroll",view);
    //返回yes 是不滚动 scroll 返回no 是滚动scroll
    return YES;
}
- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
 
    NSLog(@"用户点击的视图 %@",view);
   
    //NO scroll不可以滚动 YES scroll可以滚动
    return NO;
}
@end
